package org.logic.linguisticSummaries.type24summaries;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

import org.logic.fuzzysets.AFuzzySet;
import org.logic.linguisticSummaries.type21summaries.SummaryTypeTwoOne;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class SummaryTypeTwoFourContainer {

	private static Logger logger = LoggerFactory.getLogger(SummaryTypeTwoFourContainer.class);

	protected List<AFuzzySet> summarizers;
	
	public SummaryTypeTwoFourContainer() {
		
		summarizers = new ArrayList<AFuzzySet>();
	}
	
	public void addSummarizer(AFuzzySet summarizer) {
		summarizers.add(summarizer);
	}

	public Map<String,Double> generateAllSummariesO() {
		
		logger.info("\n============================ TYPE 24 ============================");
		Map<String,Double> summaries = new TreeMap<String,Double>();		
	
				for (AFuzzySet summarizer : summarizers) {
	
					SummaryTypeTwoFour summaryTypeTwoFour = new SummaryTypeTwoFour(summarizer.getSubject(),summarizer.getQualifier().getSubject(), summarizer);
					String summary = summaryTypeTwoFour.generateSummary();
					summaries.put(summary,summaryTypeTwoFour.getDegreeOfTruth());
					//logger.info(summary);
				}
				
		return summaries;
	}
	
	public Map<Double,String> generateAllSummaries() {
		
		logger.info("\n============================ TYPE 24 ============================");
		Map<Double,String> summaries = new TreeMap<Double,String>();		
	
		for (AFuzzySet summarizer : summarizers) {
			
			SummaryTypeTwoFour summaryTypeTwoFour = new SummaryTypeTwoFour(summarizer.getSubject(),summarizer.getQualifier().getSubject(), summarizer);
			String summary = summaryTypeTwoFour.generateSummary();
			summaries.put(summaryTypeTwoFour.getDegreeOfTruth(),summary);
			//logger.info(summary);
		}

		return summaries;
	}
	
}
